<?php
$menu      = array();
$childMenu = array();

if (Users::checkAccess('index', 'User'))
{
    $childMenu[] = array(
        'label'  => Yii::t('user', 'Administrator'),
        'url'    => url("user/index"),
        'icon'   => 'icon-user-md',
        'active' => 'user'
    );
}
//if (Users::checkAccess('index', Users::TYPE_CUSTOMER))
//{
//    $childMenu[] = array(
//        'label'  => Yii::t('user', 'Customer'),
//        'url'    => url("customer/index"),
//        'icon'   => 'icon-user-md',
//        'active' => strtolower(Users::TYPE_CUSTOMER)
//    );
//}
//if (!empty($childMenu))
//{
//    $menu[] = array(
//        'label' => Yii::t('user', 'User Management'),
//        'icon'  => 'icon-group',
//        'items' => $childMenu
//    );
//};

// Menu cho Phân quyền
//unset($childMenu);
//$childMenu = array();
//if (Users::checkAccess('index', 'auth'))
//{
//    $childMenu[] = array(
//        'label'  => Yii::t('auth', 'Role'),
//        'url'    => url('auth/index'),
//        'icon'   => 'icon-list-ul',
//        'active' => 'auth'
//    );
//}
//
//if (Users::checkAccess('auto', 'auth'))
//{
//    $childMenu[] = array(
//        'label'  => Yii::t('auth', 'Operation'),
//        'url'    => url('auth/index', array('type' => AuthItem::TypeOperation)),
//        'icon'   => 'icon-check',
//        'active' => 'authOpera',
//    );
//}
//
//if (!empty($childMenu))
//{
//    $menu[] = array(
//        'label' => Yii::t('auth', 'Authorization'),
//        'icon'  => 'icon-group',
//        'items' => $childMenu,
//    );
//}
unset($childMenu);

//Start Menu Setting
$childMenu = array();
//if (Users::checkAccess('index', 'Option'))
//{
//    $childMenu[] = array(
//        'label'  => Yii::t('user','Option List'),
//        'url'    => url('option/index'),
//        'icon'   => 'icon-cog',
//        'active' => 'option'
//    );
//}
if (Users::checkAccess('config', 'Option'))
{
    $childMenu[] = array(
        'label'  => Yii::t('user','Option Config'),
        'url'    => url('option/config'),
        'icon'   => 'icon-wrench',
        'active' => 'option'
    );
}
if (Users::checkAccess('file', 'Option'))
{
    $childMenu[] = array(
        'label'  => Yii::t('user','File Manager'),
        'url'    => url('option/file'),
        'icon'   => 'icon-folder-open',
        'active' => 'option'
    );
}

//if (Users::checkAccess('index', 'Slider'))
//{
//    $childMenu[] = array(
//        'label'  => 'Slider Items',
//        'url'    => url('slider/index'),
//        'icon'   => 'icon-magnet',
//        'active' => 'slider'
//    );
//}
//
//if (Users::checkAccess('index', 'Contact'))
//{
//    $childMenu[] = array(
//        'label'  => 'Contact Message',
//        'url'    => url('contact/index'),
//        'icon'   => 'icon-envelope',
//        'active' => 'contact'
//    );
//}
//
//if (Users::checkAccess('index', 'Subscribe'))
//{
//    $childMenu[] = array(
//        'label'  => 'Subscription',
//        'url'    => url('subscribe/index'),
//        'icon'   => 'icon-star',
//        'active' => 'subscribe'
//    );
//}
//
if (!empty($childMenu))
{
    $menu[] = array(
        'label' => Yii::t('user','Setting'),
        'icon'  => 'icon-cog',
        'items' => $childMenu,
    );
}
//End Menu Setting

unset($childMenu);
$childMenu = array();

if (Users::checkAccess('index', 'category'))
{
    $menu[] = array(
        'label'  => Yii::t('user', 'Category'),
        'url'    => url('category/index'),
        'icon'   => 'icon-list',
        'active' => 'category',
    );
}
//Menu product
if (Users::checkAccess('index', 'product'))
{
    $menu[] = array(
        'label'  => Yii::t('user', 'Product'),
        'url'    => url('product/index'),
        'icon'   => 'icon-glass',
        'active' => 'product',
    );
}
//Menu product
if (Users::checkAccess('index', 'post'))
{
    $menu[] = array(
        'label'  => Yii::t('user', 'Post'),
        'url'    => url('post/index'),
        'icon'   => 'icon-book',
        'active' => 'post',
    );
}
if (Users::checkAccess('index', 'Menu'))
{
    $menu[] = array(
        'label'  => 'Menu',
        'url'    => url('menu/index'),
        'icon'   => 'icon-list-alt',
        'active' => 'menu'
    );
}
//End of menu product
/*
 * Menu for Report
 */
unset($childMenu);
if (Users::checkAccess('index', 'Partner'))
{
    $menu[] = array(
        'label' => Yii::t('user', 'Partner'),
        'icon'  => 'icon-user',
        'url'    => url('partner/index'),
        'active'    => 'partner',
    );
}
if (Users::checkAccess('index', 'Slider'))
{
    $menu[] = array(
        'label' => Yii::t('user', 'Slider'),
        'icon'  => 'icon-film',
        'url'    => url('slider/index'),
        'active'    => 'slider',
    );
}

if (Users::checkAccess('index', 'Contact'))
{
    $menu[] = array(
        'label'  => Yii::t('user', 'Contact'),
        'url'    => url('contact/index'),
        'icon'   => 'icon-envelope',
        'active' => 'contact'
    );
}
//if (Users::checkAccess('index', 'accessLog'))
//{
//    $childMenu[] = array(
//        'label'  => 'Access Log',
//        'url'    => url('accessLog/index'),
//        'icon'   => 'icon-reorder',
//        'active' => 'accessLog',
//    );
//}
//
//if (!empty($childMenu))
//{
//    $menu[] = array(
//        'label' => 'Report',
//        'icon'  => 'icon-briefcase',
//        'items' => $childMenu
//    );
//}
return $menu;
/**
 * End of MainMenu
 */
